
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import loginPage from  '../pages/loginPage/loginPage.vue'
import pageIndex from '../pages/index/index.vue'
import partNews from '../pages/partNews/partNews.vue'
import activity from '../pages/activity/index.vue'
import assessment from '../pages/userRank/userRank.vue'
import cloudExhibition from '../pages/cloudExhibition/cloudExhibition.vue'
import ffcl from '../pages/ffcl/ffcl.vue'
import heart from '../pages/heart/heart.vue'
import onLineExam from '../pages/onLineExam/onLineExam.vue'
import partAlbum from '../pages/partAlbum/partAlbum.vue'
import partScholl from '../pages/partScholl/partScholl.vue'
import supervise from '../pages/supervise/supervise.vue'
import reportItem from '../pages/reportItem/reportItem.vue'
import login from '../pages/login/login.vue'
import regeister from '../pages/regeisterPage/regeisterPage.vue'
import notFound from '../pages/notFound/404.vue'
import partIndex from '../pages/partIndex/partIndex'
import partcourse from '../pages/partcourse/partcourse.vue'
import mine from '../pages/mine/mine.vue'
import reportForm from '../pages/reportForm/reportForm.vue'
import reportSubmit from '../pages/reportSubmit/reportSubmit.vue'
import userCenter from '../pages/userCenter/userCenter.vue'
import userInfo from '../components/userInfo.vue'
import notice from '../pages/notice/notice.vue'
import advice from '../components/advice.vue'
import editorUser from '../components/editorUser.vue'
import about from '../components/about.vue'
import aboutCompany from '../components/aboutCompany.vue'
import editor from '../components/editor.vue'
import article from '../pages/article/article.vue'
import videoList from '../pages/videoList/videoList.vue'
import selectCourse from '../pages/selectCourse/selectCourse.vue'
import activeDetail from '../pages/activeDetail/activeDetail.vue'
import contribute from '../pages/contribute/contribute.vue'
import albumDetail from '../pages/albumDetail/albumDetail.vue'
import userScore from '../pages/userScore/userScore.vue'
import resetPassword from '../pages/resetPassword/index.vue'
import heartList from '../pages/notice/heart.vue'
import newsNotice from '../pages/newsNotice/index.vue'
import store from '../pages/store/store.vue'
const router =new Router({
    routes:[

      {
        path:'/loginPage',
        name:'loginPage',
        component:loginPage
      },
      {
        path:'/',
        name:'pageIndex',
        component:pageIndex
      },
      {
        path:'/partNews',
        name:'partNews',
        component:partNews
      },
      {
        path:'/selectCourse',
        name:'selectCourse',
        component:selectCourse
      },
      {
        path:'/resetPassword',
        name:'resetPassword',
        component:resetPassword
      },
      {
        path:'/userScore',
        name:'userScore',
        component:userScore
      },
      {
        path:'/albumDetail',
        name:'albumDetail',
        component:albumDetail
      },
      {
        path:'/contribute',
        name:'contribute',
        component:contribute
      },
      {
        path:'/activeDetail',
        name:'activeDetail',
        component:activeDetail,
      },
      {
        path:'/activity',
        name:'activity',
        component:activity,
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
      }
      ,{
        path:'/assessment',
        name:'assessment',
        component:assessment,
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
      },{
        path:'/cloudExhibition',
        name:'cloudExhibition',
        component:cloudExhibition
      },{
        path:'/ffcl',
        name:'ffcl',
        component:ffcl
      },
      {
        path:'/heartList',
        name:'heartList',
        component:heartList
      },
      {
        path:'/heart',
        name:'heart',
        component:heart
      },{
        path:'/onLineExam',
        name:'onLineExam',
        component:onLineExam
      },{
        path:'/partAlbum',
        name:'partAlbum',
        component:partAlbum
      },{
        path:'/partScholl',
        name:'partScholl',
        component:partScholl,
        redirect:'/partScholl/index',
        meta: {
          requireAuth: true,
        },
        children:[
          {
            path:'index',
            name:'partIndex',
            component:partIndex,
            meta: {
              requireAuth: true
            },
          },
          {
            path:'partcourse',
            name:'partcourse',
            component:partcourse,
            meta: {
              requireAuth: true
            },
          },
          {
            path:'mine',
            name:'mine',
            component:mine,
            meta: {
              requireAuth: true
            },
          },
          {
            path:'',
            redirect:'/partScholl/index'
          }
        ]
      },{
        path:'/supervise',
        name:'supervise',
        component:supervise
      },
      { path:'/videoList',
        name:'videoList',
        component:videoList,
        meta: {
          requireAuth: true
        },
      },
      {
        path:'/reportItem',
        name:'reportItem',
        component:reportItem,
      },
      {
        path:'/reportForm',
        name:'reportForm',
        component:reportForm,

      },
      {
        path:'/login',
        name:'login',
        component:login
      },
      {
        path:'/regeister',
        name:'regeister',
        component:regeister
      },{
        path:'/reportSubmit',
        name:'reportSubmit',
        component:reportSubmit
      }
      ,{
        path:'/userCenter',
        name:'userCenter',
        component:userCenter,
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        },
      },
      {
        path:'/newsNotice',
        name:'newsNotice',
        component:newsNotice,
      },
      {
        path:'/userInfo',
        name:'userInfo',
        component:userInfo,
      },
      {
        path:'/notice',
        name:'notice',
        component:notice,
      },
      {
        path:'/advice',
        name:'advice',
        component:advice,
      },
      {
        path:'/about',
        name:'about',
        component:about,
      },
      {
        path:'/aboutCompany',
        name:'aboutCompany',
        component:aboutCompany,
      },
      {
        path:'/editorUser',
        name:'editorUser',
        component:editorUser,
      },
      {
        path:'/editor',
        name:'editor',
        component:editor,
      },
      {
        path:'/article',
        name:'article',
        component:article,
      },
      {
        path:'/store',
        name:'store',
        component:store,
      },{
        path: "*",
        component:notFound
      },
      // mode:'history'
    ]
})

// if(localStorage.getItem('uid')&&localStorage.getItem('userAccount')){
//       //  已登录
//   router.beforeEach((to, from, next) => {
//       next({
//         path: '/index',
//       });
//   });
// }else{
//     next({
//       path: '/',
//     });
// }


export default router
